#include "coin.h"

Coin::Coin(GameGraphic* pGraphic, float x, float y, int _layer) : DynamicObject()
{	
    if (mSprite.find("coin") == mSprite.end())
    {	
        char path[100] = "Data\\Mario Sprites\\coin.png";
        mSprite["coin"] = new DXSprite(pGraphic, path, D3DCOLOR_XRGB(0, 0, 0), 1, 4);
    } 
    pSprite = mSprite["coin"];
    posX = x;
    posY = y;
    layer = _layer;
    anima = Animation(pSprite, 0, 3);
}

void Coin::Render(unsigned int gameTime)
{	
    pSprite->SetPosition(posX - originX, posY - originY);
    anima.Present(gameTime, 1000 / 8, 0.8);
    return;
}